package com.jsyl.lwbk.web.controller.business;

import com.jsyl.lwbk.business.domain.CourseChildProject;
import com.jsyl.lwbk.business.service.CourseChildProjectService;
import com.jsyl.lwbk.common.core.controller.BaseController;
import com.jsyl.lwbk.common.core.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * 训练计划
 */
@Controller
@RequestMapping("/business/courseChildProject")
public class CourseChildProjectController extends BaseController {

    private String prefix = "business/courseChildProject";

    @Autowired
    CourseChildProjectService courseChildProjectService;



    /**
     *备课保存项目
     *
     * @return
     */
    @PostMapping("/saveProject")
    @ResponseBody
    public AjaxResult saveProject(@RequestBody CourseChildProject project) {
        return success(courseChildProjectService.saveProject(project));
    }
    /**
     *备课:全员选择
     *
     * @return
     */
    @PostMapping("/saveAllLink")
    @ResponseBody
    public AjaxResult saveAllLink(@RequestBody CourseChildProject project) {
        return success(courseChildProjectService.saveAllLink(project));
    }

    /**
     *保存项目训练量
     *
     * @return
     */
    @PostMapping("/saveTrainAmount")
    @ResponseBody
    public AjaxResult saveTrainAmount(@RequestBody CourseChildProject project) {
        courseChildProjectService.saveTrainAmount(project);
        return success();
    }

    /**
     *保存项目训练量
     *
     * @return
     */
    @GetMapping("/getProject")
    @ResponseBody
    public AjaxResult getProject(@RequestParam("childCourseId")Long childCourseId,
                                 @RequestParam("childId")Long childId) {

        return success(courseChildProjectService.getProject(childCourseId,childId));
    }







}
